<!DOCTYPE html>
<head>
    <title>自定义函数</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet"> </head>
</head>
<body>
    自定义函数

</body>
<script>


function fun1(){ console.log("fun1()")   }
//自定义函数的3种方式
//1.函数声明
function hello(){  
    console.log("hello()")  
    window.open("https://www.baidu.com")  }
//2.对象变量方式,对象变量式会在定义的时候跑
var fn = new function(){
    //window.location.href="https://www.baidu.com"; 
   // window.open("https://www.baidu.com")
   console.log("fn()")  
}
//3.箭头函数
var fn2 = () => {   console.log("fn2()")  }



</script>

</html>